package com.leyou.user.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import org.hibernate.validator.constraints.Length;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.util.Date;

/**
 * 用户表(TbUser)实体类
 *
 * @author makejava
 * @since 2020-05-02 18:51:10
 */
@Table(name = "tb_user")
public class TbUser implements Serializable {
    private static final long serialVersionUID = -77653993308535214L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    /**
    * 用户名
    */
    @Length(min = 4,max = 30,message = "用户名只能在4-30之间")
    private String username;
    /**
    * 密码，加密存储
    */
    @JsonIgnore
    @Length(min = 4,max = 30,message = "密码只能在4-30之间")
    private String password;
    /**
    * 注册手机号
    */
    @Pattern(regexp = "^1[35678]\\d{9}$",message = "手机格式不正确")
    private String phone;
    /**
    * 创建时间
    */
    private Date created;
    /**
    * 密码加密的salt值
    */
    @JsonIgnore
    private String salt;


    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public Date getCreated() {
        return created;
    }

    public void setCreated(Date created) {
        this.created = created;
    }

    public String getSalt() {
        return salt;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }

}